import store from "@/store";

// 储存
export async function setlocalData() {
  // 清除缓存信息
  localStorage.removeItem("user");
  // 缓存用户
  const user = store.getters.user;
  localStorage.setItem("user", JSON.stringify(user));
}
// 获取
export async function getlocalData() {
  // 初始化用户
  const user = localStorage.getItem("user");
  if (user)
    store.commit("SET", {
      key: "user",
      value: JSON.parse(user),
    });
}
